package com.huige.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author 92746
 */
@Slf4j
@Component
//@Aspect
public class MyAspect1 {

    @Pointcut("execution(* com.huige.service.impl.DeptServiceImpl.*(..))")
    public void pt() {

    }

    @Before("pt()")
    public void before() {
        log.info("before...");
    }


    @Around("pt()")
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        log.info("around before...");

        //调用目标对象的原始方法执行了
        Object proceed = joinPoint.proceed();


        log.info("around after...");
        return proceed;
    }

    @AfterReturning("pt()")
    public void afterReturning() {
        log.info("afterReturning...");
    }


    @After("pt()")
    public void after() {
        log.info("after...");
    }

    @AfterThrowing("pt()")
    public void afterThrowing() {
        log.info("afterThrowing...");
    }


}
